package processingExample;

import processing.core.PApplet;

public class ProcessingExample2 extends PApplet
{
	int ellipseX = 100;
	int ellipseY = 100;
	int stage = 1;
	
	public void setup()
	{
		size(1000, 500);
		background(255, 255, 0);
	}
	
	public void draw()
	{
		size(1000, 500);
		background(255, 255, 0);
		
		fill(0, 0, 255);
		ellipse(ellipseX,ellipseY,50,50);
		
		if(stage == 1)
		{
			ellipseY++;
			
			if(ellipseY>=200)
				stage = 2;
		}
		else if(stage == 2)
		{
			ellipseX++;
			
			if(ellipseX>=200)
				stage = 3;
		}
		else if(stage == 3)
		{
			ellipseY--;
			
			if(ellipseY<=100)
				stage = 4;
		}
		else if(stage == 4)
		{
			ellipseX--;
			
			if(ellipseX<=100)
				stage = 1;
		}
	}	
}
